$(function() {
	// 页面加载时，导航条2隐藏
	$('#nav2').hide();

	// 导航条1里的【商家管理】得到鼠标（焦点）时，导航条2淡入
	$('#nav1_child').mouseenter(function() {
		$('#nav2').fadeIn(250);
		$('#upAndDownChange').attr('src', '../images/up.png');
	});

	// 导航条1里的【商家管理】失去鼠标（焦点）时，导航条2隐藏
	$('#nav1_child').mouseleave(function() {
		$('#nav2').hide();
		$('#upAndDownChange').attr('src', '../images/down.png');
	});

	// 如果焦点一直停留在导航条2上，导航条2显示
	$('#nav2').hover(function() {
		$('#nav2').show();
		$('#upAndDownChange').attr('src', '../images/up.png');
	})

	// 如果导航条2失去焦点时，导航条2隐藏
	$('#nav2').mouseleave(function() {
		$('#nav2').hide();
		$('#upAndDownChange').attr('src', '../images/down.png');
	});

	if (sessionStorage.getItem('username') != null) {
		$('#loginStatus').html('欢迎，' + sessionStorage.getItem('username'));
	} else {
		$('#loginStatus').html('未登录');
	}

})

window.onload = function() {
	setInterval("NowTime()", 1000);
}
function NowTime() {
	var time = new Date();
	var year = time.getFullYear();
	var month = time.getMonth() + 1;
	var day = time.getDate();

	var h = time.getHours();
	var m = time.getMinutes();
	var s = time.getSeconds();

	month = check(month);
	day = check(day);
	h = check(h);
	m = check(m);
	s = check(s);
	document.getElementById("nowtime").innerHTML = year + "-" + month + "-"
			+ day + " " + h + ":" + m + ":" + s;
}
function check(i) {
	if (i < 10) {
		i = "0" + i;
	}
	return i;
}